#include <global.h>
#include <osmisc.h>
#include <nsfdb.h>
#include <osfile.h>
#include <kfm.h>
#include <idtable.h>
#include <nsfnote.h>
#include <stdnames.h>
#include <nsfsearc.h>
#include <osmem.h>
#include <names.h>
#include <mailserv.h>
#include <ns.h>
#include <osenv.h>
#include <extmgr.h>
#include <bsafeerr.h>
#include <nsferr.h>


#include <winreg.h>

HINSTANCE hDll;

typedef STATUS (CALLBACK *OSPATHNETCONSTRUCT)(
	const TCHAR far *PortName,
	const TCHAR far *ServerName,
	const TCHAR far *FileName,
	TCHAR far *retPathName);
OSPATHNETCONSTRUCT OSPathNetConstruct1;

typedef STATUS  (CALLBACK LNPUBLIC *NOTESINITEXTENDED)(
	int  argc,
	char far * far *argv);
NOTESINITEXTENDED NotesInitExtended1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFDBOPEN)(
	const TCHAR far *PathName,
	DBHANDLE far *rethDB);
NSFDBOPEN NSFDbOpen1;

typedef STATUS  (CALLBACK LNPUBLIC *SECKFMGETUSERNAME)(
	TCHAR far *retUserName);
SECKFMGETUSERNAME SECKFMGetUserName1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFDBGETUNREADNOTETABLE)(
	DBHANDLE  hDB,
	TCHAR far *UserName,
	WORD  UserNameLength,
	BOOL  fCreateIfNotAvailable,
	HANDLE far *rethUnreadList);
NSFDBGETUNREADNOTETABLE NSFDbGetUnreadNoteTable1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFDBUPDATEUNREAD)(
	DBHANDLE  hDataDB,
	HANDLE  hUnreadList);
NSFDBUPDATEUNREAD NSFDbUpdateUnread1;

typedef BOOL  (CALLBACK LNPUBLIC *IDSCAN)(
	HANDLE  hTable,
	BOOL  fFirst,
	DWORD far *retID);
IDSCAN IDScan1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFNOTEOPEN)(
	DBHANDLE  db_handle,
	NOTEID  note_id,
	WORD  open_flags,
	NOTEHANDLE far *note_handle);
NSFNOTEOPEN NSFNoteOpen1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFDBGETNOTEINFO)(
	DBHANDLE  hDb,
	NOTEID  NoteID,
	OID far *retNoteOID,
	TIMEDATE far *retModified,
	WORD far *retNoteClass);
NSFDBGETNOTEINFO NSFDbGetNoteInfo1;

typedef WORD  (CALLBACK LNPUBLIC *NSFITEMGETTEXT)(
	NOTEHANDLE  note_handle,
	const TCHAR far *item_name,
	TCHAR far *item_text,
	WORD  text_len);
NSFITEMGETTEXT NSFItemGetText1;

typedef BOOL (CALLBACK LNPUBLIC *NSFITEMGETTIME)(
	NOTEHANDLE  note_handle,
	const TCHAR far *td_item_name,
	TIMEDATE far *td_item_value);
NSFITEMGETTIME NSFItemGetTime1;

typedef STATUS (CALLBACK LNPUBLIC *CONVERTTIMEDATETOTEXT)(
	const void far *IntlFormat,
	const TFMT far *TextFormat,
	const TIMEDATE far *InputTime,
	TCHAR far *retTextBuffer,
	WORD  TextBufferLength,
	WORD far *retTextLength);
CONVERTTIMEDATETOTEXT ConvertTIMEDATEToText1;

typedef WORD  (CALLBACK LNPUBLIC *OSTRANSLATE)(
	WORD  TranslateMode,
	const TCHAR far *In,
	WORD  InLength,
	TCHAR far *Out,
	WORD  OutLength);
OSTRANSLATE OSTranslate1;

typedef BOOL (CALLBACK LNPUBLIC *MAILGETMESSAGEATTACHMENTINFO)(
	HANDLE  hMessage,
	WORD  Num,
	BLOCKID far *bhItem,
	TCHAR far *FileName,
	DWORD far *FileSize,
	WORD far *FileAttributes,
	WORD far *FileHostType,
	TIMEDATE *FileCreated,
	TIMEDATE far *FileModified);
MAILGETMESSAGEATTACHMENTINFO MailGetMessageAttachmentInfo1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFNOTECLOSE)(
	NOTEHANDLE  note_handle);
NSFNOTECLOSE NSFNoteClose1;

typedef STATUS  (CALLBACK LNPUBLIC *IDDESTROYTABLE)(
	HANDLE  hTable);
IDDESTROYTABLE IDDestroyTable1;

typedef STATUS  (CALLBACK LNPUBLIC *NSFDBCLOSE)(
	DBHANDLE  hDB);
NSFDBCLOSE NSFDbClose1;

typedef WORD  (CALLBACK LNPUBLIC *OSLOADSTRING)(
	HMODULE  hModule,
	STATUS  StringCode,
	TCHAR far *retBuffer,
	WORD  BufferLength);
OSLOADSTRING OSLoadString1;

typedef void  (CALLBACK LNPUBLIC *NOTESTERM)(void);
NOTESTERM NotesTerm1;

typedef BOOL (CALLBACK LNPUBLIC *OSGETENVIRONMENTSTRING)(
	const TCHAR far *VariableName,
	char far *retValueBuffer,
	WORD  BufferLength);
OSGETENVIRONMENTSTRING OSGetEnvironmentString1;

typedef void (CALLBACK LNPUBLIC *OSSETENVIRONMENTVARIABLE)(
	const TCHAR far *VariableName,
	const TCHAR far *Value);
OSSETENVIRONMENTVARIABLE OSSetEnvironmentVariable1;

typedef STATUS  (CALLBACK LNPUBLIC *NSGETSERVERLIST)(
	TCHAR far *pPortName,
	HANDLE far *retServerTextList);
NSGETSERVERLIST NSGetServerList1;

typedef far*  (CALLBACK LNPUBLIC *OSLOCKOBJECT)(
	HANDLE  Handle);
OSLOCKOBJECT OSLockObject1;

typedef BOOL (CALLBACK LNPUBLIC *OSUNLOCKOBJECT)(
	HANDLE  Handle);
OSUNLOCKOBJECT OSUnlockObject1;

typedef STATUS  (CALLBACK LNPUBLIC *OSMEMFREE)(
	HANDLE  Handle);
OSMEMFREE OSMemFree1;

BOOL HookLotusFunctions();
void GetLotusPath(TCHAR *sTemp, DWORD size);

typedef STATUS  (CALLBACK LNPUBLIC *EMREGISTER)(
	EID  EmID,
	DWORD  Flags,
	EMHANDLER  Proc,
	WORD  RecursionID,
	HEMREGISTRATION far *rethRegistration);
EMREGISTER EMRegister1;

typedef STATUS  (CALLBACK LNPUBLIC *EMDEREGISTER)(
	HANDLE  Handle);
EMDEREGISTER EMDeregister1;

typedef STATUS  (CALLBACK LNPUBLIC *NOTESINITTHREAD)(void);
NOTESINITTHREAD NotesInitThread1;

typedef void  (CALLBACK LNPUBLIC *NOTESTERMTHREAD)(void);
NOTESTERMTHREAD NotesTermThread1;
